<?php
include 'global.php';
include 'changepass.php';
include 'sub/header.php';
?>
<script type="tetext/javascript" src="../js/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
    function ltrim(str) {
        return str.replace(/^\s+/g, '');
    }

    function rtrim(str) {
        return str.replace(/\s+$/g, '');
    }

    function trim(str) {
        return ltrim(rtrim(str));
    }
    function checkleng(){
        var newpass = trim(document.getElementById('newpass').value);
        var newpass2 = trim(document.getElementById('newpass2').value);
        if(newpass.length < 6 || newpass2.length < 6)
        {
            alert('Password phải có ít nhất 6 ký tự');
            return false;
        }
        else if (newpass != newpass2)
        {
            alert('Password mới không trùng khớp!');
            return false;
        }
        return true;
    }

</script>
<form method="post"  action="<?php echo $_SERVER['REQUEST_URI']; ?>" onsubmit="checkleng()">
    <div class="content-outer">
        <div class="content-inner">
            <div class="title_border">
                <h1>Thay đổi password</h1>
            </div>
            <table width="100%" border="0" cellspacing="0" cellpadding="4">
                <tr>
                    <td colspan="2" >&nbsp;</td>
                </tr>
                <tr>
                    <td align="right">Password củ</td>
                    <td><input type="password" id="oldpass" name="oldpass" class="txtconfig"/> </td>
                </tr>
                <tr>
                    <td align="right">Password mới</td>
                    <td><input type="password" id="newpass" name="newpass" class="txtconfig" /> </td>
                </tr>
                <tr>
                    <td align="right">Nhập lại password mới</td>
                    <td><input type="password" id="newpass2" name="newpass2" class="txtconfig"/> </td>
                </tr>
                <tr>
                    <td colspan="2" align="center" ><input type="submit" value="Đổi pass" name="submit"/> </td>
                </tr>
            </table>
        </div>
    </div>
</form>
<?php
include 'sub/footer.php';
?>